package org.example.java.socket.TCP;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;

public class Client3 {
	public static void main(String[] args) throws Exception {
		Socket client = new Socket("127.0.0.1", 6666);
		
		DataOutputStream dos = new DataOutputStream(client.getOutputStream());
		Thread.sleep(2000);
		dos.writeUTF("hello!");
		dos.flush();
		
		DataInputStream dis = new DataInputStream(client.getInputStream());
		System.out.println(dis.readUTF());
		dis.close();
		dos.close();
		client.close();
	}
}
